/**
 * Plugin: jquery.desktopdesigner
 * 
 * Version: 1.0.0
 * (c) Copyright 2010, teryaki.eu Ltd
 * 
 * Description: jQuery plugin for designing background as image or gradient color
 *              
 **/
(function( $ ){
	$.fn.desktopdesigner = function( options ) {	
	if(options){
		var ieOpa;
		if(!options['img']) { options['img'] = 'https://lh4.googleusercontent.com/_uQrqXfujEKA/TXl9cAAmkiI/AAAAAAAAAB0/L7r6D5FN5Jw/s128/transparent.gif'; }
		if(!options['start']){ options['start'] = '#FFFFFF'; }
		if(!options['end']) { options['end'] = '#FFFFFF'; }
		if(!options['opa']) { options['opa'] = '1'; ieOpa = 100; } else { ieOpa = eval(options['opa'] + ' * 100'); }
		
		
		$('#desktopdesigner').remove();
		
		var newContent = '<img id="desktopdesigner" src="' + options['img'] + '" style="'+
			'background: -moz-linear-gradient(top,  ' + options['start'] + ',  ' + options['end'] + '); '+ 
			'background: -webkit-gradient(linear, left top, left bottom, from(' + options['start'] + '), to(' + options['end'] + ')); '+
			'filter:alpha(opacity=' + ieOpa + ') progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=\'' + options['start'] + '\',EndColorStr=\'' + options['end'] + '\'); '+
			'-moz-opacity:' + options['opa'] + '; -khtml-opacity:' + options['opa'] + '; opacity:' + options['opa'] + '; '+
			'position:absolute; margin:0px; width:100%; height:100%; overflow:hidden; top:0px; left:0px; '+
			'">';
		this.append( newContent );
		$('#desktopdesigner').fadeIn('slow');
	}
	

  };
})( jQuery );
